package com.smz.controller;

import com.smz.entity.Commodity;
import com.smz.service.CommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class CommodityController {

    @Autowired
    private CommodityService commodityService;

    @GetMapping("commodities")
    public ResponseEntity<List<Commodity>> findAllCommodity(){
        return ResponseEntity.ok(commodityService.findAllCommodity());
    }
}
